<template>
	<view class="writeEmail" :class="APPTheme">
		<uni-nav-bar fixed status-bar left-text="取消" right-text="发送" title="发邮件" :color="APPTheme=='theme-light'?'#000000':'#ffffff'" :background-color="APPTheme=='theme-light'?'#ffffff':'#000000'" @clickRight="clickRightclose" @clickLeft="clickLeftback"></uni-nav-bar>
		<view class="center">
			<view class="center-item theme-border-bottom">
				<view class="item-left">收件人:</view>
				<view class="item-center">
					<!-- 已选择的人 -->
					<u-tag v-for="(item,index) in addressee.employeesList" :key="item.id" class="tag" :text="item.name" mode="light" type="primary" shape="circle" :index="item.id" size="mini" close-color="#ff5500" closeable @close="closeTagFn($event,'addressee','employeesList')"/>
					<!-- 已选择的组织 -->
					<u-tag v-for="(item,index) in addressee.departmentsList" :key="item.id" class="tag" :text="item.orgName" mode="light" type="primary" shape="circle" :index="item.id" size="mini" close-color="#ff5500" closeable @close="closeTagFn($event,'addressee','departmentsList')"/>
					<!-- 已选择的角色 -->
					<u-tag v-for="(item,index) in addressee.roleList" :key="item.id" class="tag" :text="item.roleName" mode="light" type="primary" shape="circle" :index="item.id" size="mini" close-color="#ff5500" closeable @close="closeTagFn($event,'addressee','roleList')"/>
				</view>
				<view class="item-right theme-bg-active" @click="navigateToFn('收件人')">
					<uni-icons type="plus" size="22" color="#0088fe"></uni-icons>
				</view>
			</view>
			<view class="center-item theme-border-bottom" >
				<view class="item-left">抄送:</view>
				<view class="item-center">
					<!-- 已选择的人 -->
					<u-tag  v-for="(item,index) in copyList.employeesList" :key="item.id" class="tag" :text="item.name" mode="light" type="primary" shape="circle" :index="item.id" size="mini" close-color="#ff5500" closeable @close="closeTagFn($event,'copyList','employeesList')"/>
					<!-- 已选择的组织 -->
					<u-tag  v-for="(item,index) in copyList.departmentsList" :key="item.id" class="tag" :text="item.orgName" mode="light" type="primary" shape="circle" :index="item.id" size="mini" close-color="#ff5500" closeable @close="closeTagFn($event,'copyList','departmentsList')"/>
					<!-- 已选择的角色 -->
					<u-tag v-for="(item,index) in copyList.roleList" :key="item.id" class="tag" :text="item.roleName" mode="light" type="primary" shape="circle" :index="item.id" size="mini" close-color="#ff5500" closeable @close="closeTagFn($event,'copyList','roleList')"/>
				</view>
				<view class="item-right theme-bg-active" @click="navigateToFn('抄送人')">
					<uni-icons type="plus" size="22" color="#0088fe"></uni-icons>
				</view>
			</view>
			<view class="center-item theme-border-bottom">
				<view class="item-left">主题:</view>
				<view class="item-center">
					<input v-model="mailSubject" class="input"/>
				</view>
			</view>
			<lz-editor @input="mailContentFn" :content="replyMailContentDelta" :htmlContent="htmlContent" v-if="replyMailContentDelta||htmlContent"></lz-editor>
			
			<uni-swipe-action >
				<uni-swipe-action-item :options="update.actionOption" v-for="(item,index) in update.list" :key="index" @click="actionOptionClick($event,item)">
					<view class="swipe-action-item theme-bg theme-border-bottom-auto theme-bg-active">
						<uni-list>
							<uni-list-item :thumb="computedFileType(item)" :title="item.fileName" :note="computeFileSize(item.fileSize)" rightText="查看" @click="seeFileFn(item)"></uni-list-item>
						</uni-list>
					</view>
				</uni-swipe-action-item>
			</uni-swipe-action>
			<view class="float-btn" @click="createUpload">
				<hover-ball type="plusempty" color="#fff" size="26"></hover-ball>
			</view>
		</view>
		
		<!-- 取消操作菜单 -->
		<u-action-sheet :list="action.list" border-radius="10" v-model="action.show" @click="clickActionFn"></u-action-sheet>
		<!-- 非量子上传 -->
		<l-file ref="lFile" @up-success="upSuccess" top="75px"></l-file>
		<!-- 量子上传 -->
		<lz-file ref="lzFile" @up-success="QSSupSuccess" top="75px"></lz-file>
		<image class="qssImage" v-if="qss.animate_jiemi" src="/static/image/qss/jiemi.gif"></image>
	</view>
</template>

<script>
let that
import {
	mapGetters,
	mapActions
} from 'vuex'
export default {
	components:{
	},
	data() {
		return {
			isPreservation:false,//返回时是否需要提示保存
			addressee:{//收件人
				employeesList:[],//已选择人
				departmentsList:[],//已选择组织
				roleList:[],//已选择的角色
			},
			copyList:{//抄送人
				employeesList:[],//已选择人
				departmentsList:[],//已选择组织
				roleList:[],//已选择的角色
			},
			mailSubject:'',//邮件标题
			htmlContent:'',// 邮件内容html格式
			mailContent:'',// 邮件内容text格式
			mailContentDelta:'',//邮件内容Delta格式
			replyMailContentDelta:[],//回复时的邮件内容Delta格式
			
			//取消操作菜单
			action:{
				list: [{
					text: '删除草稿',
					color: 'red'
				}, {
					text: '保存草稿',
					color: '#007AFF'
				}],
				show:false
			},
			update:{//上传附件
				list:[],//附件列表
				actionOption:[{
					text: '删除',
					style: {
						backgroundColor: '#dd524d'
					}
				}]
			},
			qss:{
				animate_jiemi:false,
			},
			
		}
	},
	computed: {
		...mapGetters(['APPTheme', 'userInfo', 'api']),
		//计算图片属性
		computedFileType(){
			return (item)=>{
				return that.$lizhao.lzfile.lzGetFileType(item.suffix)
			}
		},
		//计算文件大小
		computeFileSize(){
			return (size)=>{
				return that.$lizhao.lzfile.lzGetFileSize(size)
			}	
		}
	},
	onLoad(e) {
		console.log(e);
		that = this
		//监听到已选人
		uni.$off('mail_confirm')
		uni.$on('mail_confirm',(res)=>{
			console.log(res);
			//处理已选的人
			that.processSelectedPeople(res)
		})
		//监听回复
		if(e&&e.name=='回复'){
			//处理回复数据
			that.replyFn(e.id,e.mailBoxId)
		}
		if(e&&e.name=='转发'){
			//处理转发
			that.forwardFn(e.id)
		}
		if(e&&e.name=='草稿'){
			//处理草稿
			that.replyFn(e.id,5)
		}
	},
	onShow() {
		//设置主题颜色
		that.GLOBAL.setThemeColor(that.APPTheme)
	},
	methods: {
		//查看文件
		seeFileFn(item){
			console.log(item);
			//获取文件类型
			let type=that.$lizhao.lzfile.lzGetTypeSuffix(item.suffix)
			if(item.qss&&item.qss=='GK'){//国科量子解密
				that.gk_Qss_decryption(item,type)
			}else{//非量子解密
				that.notQssDecode(item,type)
			}
		},
		//无解密查看文件
		notQssDecode(item,type){
			if(type=='image'){
				uni.previewImage({
					urls:[that.GLOBAL.image_svr+item.path],
				})
			}else if(type=='word'){
				// that.$refs.lFile.open(that.GLOBAL.image_svr+item.path)
				//#ifdef APP-PLUS
					that.$refs.lFile.download(that.GLOBAL.image_svr+item.path).then(res=>{
						that.$refs.lFile.open(res)
					})
				//#endif
				//#ifdef H5
					that.$refs.lFile.open(that.GLOBAL.image_svr+item.path)
				//#endif
			}else if(type=='video'){
				uni.navigateTo({url: '/pages/template/video/video?url='+that.GLOBAL.image_svr+item.path});
			}else if(type=='audio'){
				uni.navigateTo({url: '/pages/template/audio/audio?url='+that.GLOBAL.image_svr+item.path+'&time='+item.time});
			}
		},
		//gk量子解密
		async gk_Qss_decryption(item,type){
			//开启解密动画
			that.qss.animate_jiemi=true
			//需要传入解密的字符串和秘钥secretKey【附件解密】
			let base64=await that.$lizhao.QSS.SM4DecryptBigDataEnclosure(that.GLOBAL.image_svr + item.path,item.secretKey)
			console.log(base64.slice(0,55));
			if(!base64){//解密异常
				//关闭解密动画
				that.qss.animate_jiemi=false
				return
			}
			if(type=='image'||type=='video'||type=='audio'){
				/**
				 * 实现思路：
				 * 视频和音频拿到base64，可通过h5方式将base64转成blob对象
				 * 再通过URL.createObjectURL(blob)生成指向File对象或Blob对象的URL，
				 * 此url可以放到大部分标签下的src中进行渲染，如img，video，audio
				 * */
				uni.navigateTo({url: '/pages/document/filePlay/filePlay?type='+type+'&base64='+encodeURIComponent(base64)});
				//关闭解密动画
				that.qss.animate_jiemi=false
			}else if(type=='word'){
				/**
				 * 实现思路：
				 * 通过native.js的io操作创建文件，拿到平台绝对路径
				 * 再通过原生类进行base64解码，拿到字节流bytes数组
				 * 在通过java类FileOutputStream进行文件写入bytes返回文件路径path
				 * 在通过plus.runtime.openFile(path);用第三方程序打开文件
				 * */
				// 写入字节输出流传入base64和要写入的文件名称如lizhao222.doc
				let path=await that.$lizhao.lzfile.lzFileWriter(base64,item.filingName)
				console.log(path);
				plus.runtime.openFile(path);
				//关闭解密动画
				that.qss.animate_jiemi=false
			}
		},
		//删除文件
		actionOptionClick(e,item){
			that.update.list=that.update.list.filter((res)=>{
				if(res.id!==item.id){
					return res
				}
			})
		},
		//上传附件
		createUpload(){
			if(getApp().globalData.GK_QSS_ONOFF.email){//量子选取文件
				//调用文件管理系统选取文件
				that.documentManagementSystem()
			}else{//非量子选取文件
				that.notQssFn()
			}
		},
		//调用文件管理系统选取文件进行量子加密
		documentManagementSystem(){
			/*
			选择文件并上传传入额外参数
			*/
			that.$refs.lzFile.upload({
				type:0,//邮箱附件上传type=0  1头像 2聊天文件
				uploadType:1,//0为文件柜，量子文件上传，1为邮箱，量子文件上传
				qss:'GK',//当前为国科量子加密
			});
		},
		//非量子选取文件
		notQssFn(){
			/*
			选择文件并上传
			currentWebview=当前窗口，仅app端需要传，且必传
			url=上传服务器地址，必填
			name=上传文件的key(选填，默认为file)
			header=请求头(选填)
			*/
			that.$refs.lFile.upload({
				// #ifdef APP-PLUS
				// nvue页面使用时请查阅nvue获取当前webview的api，当前示例为vue窗口
				currentWebview: that.$mp.page.$getAppWebview(),
				// #endif
				url:that.GLOBAL.host_svr+ that.api.GLOBAL_rest_file_upload_fileUpload,
				//默认file,上传文件的key
				name: 'file',
				header: {'Authorization':JSON.parse(that.userInfo).token},
				type:0//其他参数邮箱附件上传type=0  1头像 2聊天文件
				
			});
		},
		//量子附件上传成功回调
		QSSupSuccess(e){
			console.log(e);
			that.update.list.push(e)
		},
		//非量子附件上传成功回调
		upSuccess(e){
			console.log(e);
			that.update.list.push(e.data.id)
		},
		//处理已选的人
		processSelectedPeople(res){
			if(res.name=='角色'){
				if(res.type=='收件人'){
					let employeesList=that.addressee.employeesList.concat(res.employeesList)
					that.addressee={
						employeesList:employeesList,//已选的人
						departmentsList:that.addressee.departmentsList,//已选择的组织
						roleList:res.departmentsList,//已选择的角色
					}
				}else if(res.type=='抄送人'){
					let employeesList=that.copyList.employeesList.concat(res.employeesList)
					that.copyList={
						employeesList:employeesList,//已选的人
						departmentsList:that.copyList.departmentsList,//已选择的组织
						roleList:res.departmentsList,//已选择的角色
					}
				}
			}else{
				if(res.type=='收件人'){
					let employeesList=that.addressee.employeesList.concat(res.employeesList)
					that.addressee={
						employeesList:employeesList,//已选的人
						departmentsList:res.departmentsList,//已选择的组织
						roleList:that.addressee.roleList,//已选择的角色
					}
				}else if(res.type=='抄送人'){
					let employeesList=that.copyList.employeesList.concat(res.employeesList)
					that.copyList={
						employeesList:employeesList,//已选的人
						departmentsList:res.departmentsList,//已选择的组织
						roleList:that.copyList.roleList,//已选择的角色
					}
				}
			}
			//过滤人
			that.filterUserFn()
		},
		//过滤人
		filterUserFn(){
			let obj = {};
			that.addressee.employeesList = that.addressee.employeesList.reduce((cur,next) => {
			    obj[next.id] ? "" : obj[next.id] = true && cur.push(next);
			    return cur;
			},[]) 
			let obj2 = {};
			that.copyList.employeesList = that.copyList.employeesList.reduce((cur,next) => {
			    obj2[next.id] ? "" : obj2[next.id] = true && cur.push(next);
			    return cur;
			},[]) 
		},
		//处理回复数据
		replyFn(id,mailBoxId){
			if(id){
				that.GLOBAL.doGet(that.api.GLOBAL_rest_vmail_mail_read,{id}).then(res=>{
					if(res.code=='0'){
						if(mailBoxId==5){//如果是5草稿箱
							//草稿箱处理
							that.draftsFn(res.data)
						}else{
							let employeesList=[{
								name:res.data.mail.sendUser,
								id:res.data.mail.sendUserId,
								checked:true
							}]
							that.addressee={
								employeesList:employeesList,//已选的人
								departmentsList:[],//已选组织
								roleList:[],//已选择的角色
							}
							if(res.data.mail.qss&&res.data.mail.qss=='GK'){//当前是否是量子加密的
								//国科解密
								that.gk_qss_decrypet(res.data.mail,'【回复】主题：')
							}else{//非量子内容
								if(res.data.mail.mailContentDelta){
									res.data.mail.mailContentDelta=JSON.parse(res.data.mail.mailContentDelta)
								}
								that.replyMailContentDelta=res.data.mail.mailContentDelta//邮件内容
								that.mailSubject='【回复】主题：'+res.data.mail.mailSubject
							}
						}
						
					}
				})
			}
		},
		//处理转发
		forwardFn(id){
			if(id){
				that.GLOBAL.doGet(that.api.GLOBAL_rest_vmail_mail_read,{id}).then(res=>{
					if(res.code=='0'){
						that.addressee={
							employeesList:[],//已选的人
							departmentsList:[],//已选组织
							roleList:[],//已选择的角色
						}
						that.update.list=res.data.filesList
						if(res.data.mail.qss&&res.data.mail.qss=='GK'){//当前是否是量子加密的
							//国科解密
							that.gk_qss_decrypet(res.data.mail,'【转发】主题：')
						}else{//非量子内容
							if(res.data.mail.mailContentDelta){
								res.data.mail.mailContentDelta=JSON.parse(res.data.mail.mailContentDelta)
							}
							that.replyMailContentDelta=res.data.mail.mailContentDelta//邮件内容
							that.htmlContent=res.data.mail.htmlContent
							that.mailSubject='【转发】主题：'+res.data.mail.mailSubject
							
						}
					}
				})
			}
		},
		//国科解密
		gk_qss_decrypet(mail,text){
			//开启解密动画
			that.qss.animate_jiemi=true
			setTimeout(async()=>{
				let mailContent=JSON.parse(mail.mailContent)
				mailContent=await that.$lizhao.QSS.SM4DecryptBigDataText(mailContent.data,mailContent.key)//需要传入解密的字符串和秘钥secretKey
				mailContent=that.$lizhao.QSS.QSSBase64(mailContent.data)
				let htmlContent=JSON.parse(mail.htmlContent)
				htmlContent=await that.$lizhao.QSS.SM4DecryptBigDataText(htmlContent.data,htmlContent.key)//需要传入解密的字符串和秘钥secretKey
				htmlContent=that.$lizhao.QSS.QSSBase64(htmlContent.data)
				let mailContentDelta=JSON.parse(mail.mailContentDelta)
				mailContentDelta=await that.$lizhao.QSS.SM4DecryptBigDataText(mailContentDelta.data,mailContentDelta.key)//需要传入解密的字符串和秘钥secretKey
				mailContentDelta=that.$lizhao.QSS.QSSBase64(mailContentDelta.data)
				let mailSubject=JSON.parse(mail.mailSubject)
				mailSubject=await that.$lizhao.QSS.SM4DecryptBigDataText(mailSubject.data,mailSubject.key)//需要传入解密的字符串和秘钥secretKey
				mailSubject=that.$lizhao.QSS.QSSBase64(mailSubject.data)
				let req={
					...mail,
					mailContent,
					htmlContent,
					mailContentDelta,
					mailSubject,
				}
				that.replyMailContentDelta=req.mailContentDelta//邮件内容
				that.mailSubject=text+req.mailSubject//主题
				that.qss.animate_jiemi=false
			},2000)
		},
		//草稿箱处理
		draftsFn(data){
			console.log(data);
			data.receiveUserList.forEach((res)=>{
				res.checked=true
			})
			data.receiveOrgList.forEach((res)=>{
				res.checked=true
			})
			data.receiveRoleList.forEach((res)=>{
				res.checked=true
			})
			data.copyUserList.forEach(res=>{
				res.checked=true
			})
			data.copyOrgList.forEach(res=>{
				res.checked=true
			})
			data.copyRoleList.forEach(res=>{
				res.checked=true
			})
			that.addressee={//收件人
				employeesList:data.receiveUserList,//已选的人
				departmentsList:data.receiveOrgList,//已选的组织
				roleList:data.receiveRoleList,//已选择的角色
			}
			that.copyList={//抄送人
				employeesList:data.copyUserList,//已选的人
				departmentsList:data.copyOrgList,//已选的组织
				roleList:data.copyRoleList,//已选择的角色
			}
			
			if(data.mail.qss&&data.mail.qss=='GK'){//当前是否是量子加密的
				//国科解密
				that.gk_qss_decrypet(data.mail,'')
			}else{//非量子内容
				if(data.mail.mailContentDelta){
					data.mail.mailContentDelta=JSON.parse(data.mail.mailContentDelta)
				}
				that.replyMailContentDelta=data.mail.mailContentDelta//邮件内容
				that.mailSubject=data.mail.mailSubject//邮件标题
			}
			that.update.list=data.filesList//附件
		},
		//单击操作菜单
		clickActionFn(index) {
			if(index==0){//删除草稿
				uni.navigateBack({
					delta: 1
				});
			}else if(index==1){//保存草稿
				that.clickRightclose(5)
			}
		},
		//添加人员
		navigateToFn(type){
			if(type=='收件人'){
				uni.navigateTo({url: '../selectionMethod/selectionMethod?title='+type+'&data='+JSON.stringify(that.addressee)});
			}else if(type=='抄送人'){
				uni.navigateTo({url: '../selectionMethod/selectionMethod?title='+type+'&data='+JSON.stringify(that.copyList)});
			}
		},
		//删除tag,name为删除哪个数组
		closeTagFn(index,name,type){
			console.log('删除',index,name,type);
			//过滤人
			that.filterFn(name,index,type)
		},
		//过滤人
		filterFn(name,id,type){
			that[name][type]=that[name][type].filter((res)=>{
				if(res.id!=id){
					return res
				}
			})
		},
		//返回
		clickLeftback(){
			if(that.isPreservation){
				//显示操作菜单
				that.action.show=true
			}else{
				uni.navigateBack({
					delta: 1
				});
			}
		},
		//点击导航栏右侧发送
		async clickRightclose(mailBoxId=4){
			console.log('发送',that.update.list);
			if(that.addressee.departmentsList.length==0&&that.addressee.employeesList.length==0&&that.addressee.roleList.length==0&&mailBoxId!=5){
				uni.showToast({
					title: '收件人不能为空',
					icon:'none'
				});
				return
			}
			if(!that.mailSubject&&mailBoxId!=5){
				uni.showToast({
					title: '邮件主题不能为空',
					icon:'none'
				});
				return
			}
			//收件人
			let receiveUserIds=that.addressee.employeesList.map(res=>{//选的人
				return res.id
			})
			let receiveUserNames=that.addressee.employeesList.map(res=>{
				return res.name
			})
			let receiveOrgNames=that.addressee.departmentsList.map(res=>{
				return res.orgName
			})
			let receiveOrgIds=that.addressee.departmentsList.map(res=>{
				return res.id
			})
			let receiveRoleIds=that.addressee.roleList.map(res=>{
				return res.id
			})
			let receiveRoleNames=that.addressee.roleList.map(res=>{
				return res.roleName
			})
			//抄送人
			let copyUserIds=that.copyList.employeesList.map(res=>{//选的人
				return res.id
			})
			let copyUserNames=that.copyList.employeesList.map(res=>{
				return res.name
			})
			let copyOrgNames=that.copyList.departmentsList.map(res=>{
				return res.orgName
			})
			let copyOrgIds=that.copyList.departmentsList.map(res=>{
				return res.id
			})
			let copyRoleIds=that.copyList.roleList.map(res=>{
				return res.id
			})
			let copyRoleNames=that.copyList.roleList.map(res=>{
				return res.roleName
			})
			let receiveUser={//接收者
				orgNames:receiveOrgNames.join(','),//组织名集合
				orgIds:receiveOrgIds.join(','),//组织id集合
				userIds:receiveUserIds.join(','),//用户id集合
				userNames:receiveUserNames.join(','),//用户名集合
				roleIds:receiveRoleIds.join(','),//角色id集合
				roleNames:receiveRoleNames.join(',')//角色名集合
			}
			let copySendUser={//抄送人
				orgNames:copyOrgNames.join(','),
				orgIds:copyOrgIds.join(','),
				userIds:copyUserIds.join(','),
				userNames:copyUserNames.join(','),
				roleIds:copyRoleIds.join(','),
				roleNames:copyRoleNames.join(',')
			}
			let attachId=[],attachSize=0
			if(that.update.list&&that.update.list.length>0){
				attachId=that.update.list.map((res)=>{
					return res.id
				})
				that.update.list.forEach((res)=>{
					attachSize +=res.fileSize
				})
			}
			console.log('附件总大小',attachSize);
			let req
			//是否开启国科加密
			if(getApp().globalData.GK_QSS_ONOFF.email){
				console.log(that.htmlContent);
				let mailSubject=await that.$lizhao.QSS.SM4EncryptBigData(that.mailSubject)
				let mailContent=await that.$lizhao.QSS.SM4EncryptBigData(that.mailContent)
				let mailContentDelta=await that.$lizhao.QSS.SM4EncryptBigData(that.mailContentDelta)
				let htmlContent=await that.$lizhao.QSS.SM4EncryptBigData(that.htmlContent)
				console.log(htmlContent);
				req={
					receiveUser:JSON.stringify(receiveUser),//接收者
					copySendUser:JSON.stringify(copySendUser),//抄送人
					mailSubject:JSON.stringify(mailSubject),// 邮件标题
					mailContent:JSON.stringify(mailContent),// 邮件内容text格式
					mailContentDelta:JSON.stringify(mailContentDelta),//邮件内容Delta格式
					htmlContent:JSON.stringify(htmlContent),//邮件内容html格式
					mailBoxId:mailBoxId,//5保存草稿4发件箱
					attachId:attachId.join(','),// 附件id
					attachSize:attachSize,// 附件总大小
					qss:'GK',//国科量子加密
				}
			}else{
				console.log(that.htmlContent);
				console.log('----------------------------------');
				console.log(that.$lizhao.htmlUtil.htmlDecode(that.htmlContent));
				req={
					receiveUser:JSON.stringify(receiveUser),//接收者
					copySendUser:JSON.stringify(copySendUser),//抄送人
					mailSubject:that.mailSubject,// 邮件标题
					mailContent:that.mailContent,// 邮件内容text格式
					mailContentDelta:that.mailContentDelta,//邮件内容Delta格式
					htmlContent:that.htmlContent,//邮件内容html格式
					mailBoxId:mailBoxId,//5保存草稿4发件箱
					attachId:attachId.join(','),// 附件id
					attachSize:attachSize,// 附件总大小
					qss:'',//无量子加密
				}
			}
			that.GLOBAL.doPost(that.api.GLOBAL_rest_vmail_mail_save,req).then(res=>{
				console.log(res);
				if(res.code=='0'){
					uni.showToast({
						title: res.data.msg,
						icon:'none'
					});
					uni.$emit('refresh_email_vue',true)
					uni.navigateBack({
						delta: 1,
					});
					setTimeout(()=>{
						uni.showToast({
							title: res.data.msg,
							icon:'none'
						});
					},500)
				}
			})
		},
		//接收到邮件内容
		mailContentFn(e){
			console.log(e);
			if(e.type&&e.type=='input'){
				if(e.detail.html=='<p><br></p>'){
					that.isPreservation=false
				}else{
					that.isPreservation=true//增加内容
				}
			}
			that.htmlContent=e.detail.html
			that.mailContent=e.detail.text
			that.mailContentDelta=JSON.stringify(e.detail.delta.ops)
		}
	}
};
</script>

<style scoped lang="scss">
.writeEmail{
	height: 100%;overflow-y: auto;overflow-x: hidden;
	.center{
		.center-item{
			display: flex;justify-content: space-between;align-items: center; font-size: $font_size-12;padding: 10px;box-sizing: border-box;
			.item-left{
				width: 50px;display: flex;align-items: center;justify-content: center;
			}
			.item-center{
				flex: 1;display: flex;flex-wrap: wrap;align-items: center;
				.input{
					width: 100%;
				}
				.tag{
					margin-left: 5px;margin-top: 5px;
				}
			}
			.item-right{
				width: 40px;display: flex;justify-content: center;align-items: center;z-index: 1000;
			}
		}
		.swipe-action-item{
			width: 100%;padding:0 10px;box-sizing: border-box;
		}
	}
	.qssImage{
		position: fixed;top: 0;bottom: 0;left: 0;right: 0;height: 800rpx;width: 100%;margin: auto;
	}
	
}
</style>
